<?php
use yii\web\View;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\User */
$this->registerJsFile('/js/jquery.SuperSlide.2.1.1.js');
$this->registerJsFile('/js/common_js.js',['position'=>View::POS_BEGIN]);
$this->registerCssFile('/css/common.css');
$this->registerCssFile('/fonts/iconfont.css');
$this->registerCssFile('/css/shopping-mall-index.css');
$this->registerJsFile('/js/public.js');
$this->registerJs('var area=[];',View::POS_HEAD);
$this->registerCssFile('/css/address.css');
$this->registerJsFile('/layer/layer.js');
$this->registerCssFile('/css/purebox-metro.css');
$this->registerJsFile('/js/zhonglin.js');
$this->registerJsFile('/js/purebox/application.js');
$this->registerJsFile('/js/purebox/bootstrap-affix.js');
$this->registerJsFile('/js/purebox/jquery.purebox.js');
$this->title = Yii::$app->user->identity->username . '的个人资料';
$sum=0;
$this->registerJs('function order(obj){
if($("input[name=did]").val()==undefined){
    layer.msg("请选择收货地址");
    return false;
}
}',View::POS_END);
?>
<!--确认订单页样式-->
	<div class="Inside_pages clearfix" id="Orders">
		<div class="Process">
			<img src="/images/Process_img_02.png" />
		</div>
		
    <!--内容开始-->
    <div class="payment-interface w1200">
    <?php ActiveForm::begin(['action'=>'/goods/create-order.html'])?>
    	<div class="pay-info">
        	<div class="info-tit">
            	<h3>选择收货地址</h3>
            </div>
            <ul class="pay-dz">
            <?php if(!empty($address)):?>
            <?php foreach($address as $key=>$val):?>
            	<li onclick='addressClick(this)' id='address<?=$val['id']?>' <?php if($key==0):?>class="current"<?php endif;?> data-phone='<?=$val['phone']?>' data-code='<?=$val['code']?>' data-tel='<?=$val['tel']?>' data-address='<?=$val['address']?>' data-name='<?=$val['name']?>'>
            		<input type='hidden' type='radio' name="did" value='<?=$val['id']?>'>
                	<h3><span class="sp1 address-province"><?=$district[$val['province']]?><?=$district[$val['city']]?></span>（<span class="sp3  address-name"><?=$val['name']?></span> 收）</h3>
                    <p><span class="sp1 address-address"><?=$district[$val['community']]?><?=$val['address']?></span><span class="sp2 address-tel"><?=$val['tel']?> <?=$val['phone']?></span></p>
                    <a data-id='<?=$val['id']?>' href="JavaScript:;" class='btn-primary' xiugai=""  data='<?=$val['province']?>' data1='<?=$val['city']?>' data2='<?=$val['community']?>'>修改</a>
                </li>
               <?php endforeach;?>
             <?php endif;?>  
                <div style="clear:both;"></div>
            </ul>
            <P class="pay-xgdz">修改地址和使用新地址样式一样。</P>
            <input type="button" class="pay-xdz-btn" value="使用新地址">
        </div>
            
        <div class="pay-info">
        	<div class="info-tit" style="border-bottom:0;">
            	<h3>订单信息</h3>
            </div>
        </div>
        <div class="cart-con-info">
        	<div class="cart-con-tit" style="margin:20px 0 5px;">
                <p class="p1" style="width:120px;">
                    	商品图片
                </p>
                <p class="p1" style="width:300px;">
                    <span>商品名称</span>
                </p>
                <p class="p5">单价（元）</p>
                <p class="p4" style="width:130px;">数量</p>
                <p class="p3" style="width:145px;">物流</p>
                <p class="p8" style="width:120px;">运费</p>
                <p class="p6" style="width:173px;">金额（元）</p>
            </div>
            <?php if(!empty($data)):?>
            	<?php if($flag==1)://购物车?>
                    <?php foreach($data as $val):?>
                    <?php 
                    $price=$val['num']*$val['goods']['price'];
                    $sum+=$price;
                    ?>
                    <input type='hidden' name='cid[]' value='<?=$val['id']?>'>
                    <div class="info-mid">
                        <div class="mid-tu f-l">
                        	<a href="/goods/view-<?=$val['id']?>.html" target="_blank"><img src="<?=str_replace('mid', 'small', $val['goods']['logo'])?>" /></a>
                        </div>
                        <div class="mid-font f-l" style="margin-right:55px;width:254px;line-height: 35px;">
                        	<a href="/goods/view-<?=$val['id']?>.html" target="_blank"><?=$val['goods']['name']?></a>
                        </div>
                        <p class="mid-dj f-l">¥ <?=$val['goods']['price']?></p> 
                        <div class="mid-sl f-l" style="margin:10px 52px 0px 0px;">
                        <p class="mid-dj f-l" style='margin-right: 50px;line-height: 21px;'><?=$val['num']?></p> 
                        </div>
                        <div class="mid-guige1 f-l" style="margin-right:59px">
                        	<p>快递</p>
                        </div>
                         <p class="mid-yunfei f-l">¥ 0.00</p>
                        <p class="mid-je f-l" style="margin:10px 0px 0px 0px;">¥ <?=sprintf('%.2f',$price)?></p>
                        <div style="clear:both;"></div>
                    </div>
                    <?php endforeach;?>
                     <div class="info-tijiao">
            	<p class="p1">实付款：<span>¥<span id='count_price'><?=sprintf('%.2f',$sum)?></span></span></p>
                <input type='submit' class="btn" onclick="return order(this)"  value='提交订单'>
            </div>
                    <?php elseif($flag==2):?>
                        <div class="info-mid">
                        	<input type='hidden' name='gid' value='<?=$data['id']?>'>
                            <div class="mid-tu f-l">
                            	<a href="/goods/view-<?=$data['id']?>.html" target="_blank"><img src="<?=str_replace('mid', 'small', $data['logo'])?>" /></a>
                            </div>
                            <div class="mid-font f-l" style="margin-right:65px;width:254px;line-height: 35px;">
                            	<a href="/goods/view-<?=$data['id']?>.html" target="_blank"><?=$data['name']?></a>
                            </div>
                            <p class="mid-dj f-l" style='margin: 10px 70px 0 0'>¥ <span id='price'><?=$data['price']?></span></p> 
                            <div class="mid-sl f-l" style="margin:10px 49px 0px 0px;">
                            	<a href="JavaScript:;" class="sl-left">-</a>
                                <input type="text" name='num' value="<?=max($_POST['num'],1)?>" />
                                <a href="JavaScript:;" class="sl-right">+</a>
                            </div>
                            <div class="mid-guige1 f-l" style="margin-right:59px">
                            	<p>快递</p>
                            </div>
                             <p class="mid-yunfei f-l">¥ 0.00</p>
                            <p class="mid-je f-l" style="margin:10px 120px 0px 0px;" >¥ <span id='sum_price'><?=sprintf('%.2f',$data['price'])?></span></p>
                            <div style="clear:both;"></div>
                        </div>
                         <div class="info-tijiao">
            	<p class="p1">实付款：<span>¥<span id='count_price'><?=sprintf('%.2f',max($_POST['num'],1)*$data['price'])?></span></span></p>
                <input type='submit' class="btn" onclick="return order(this)" value='提交订单'>
            </div>
                <?php endif;?>
                
            <?php endif;?>
           
           
        </div>
        <?php ActiveForm::end();?>
    </div>
	</div>
	
   